var api = require('../../config/api.js');
var app = getApp();
var util = require('../../utils/util.js');

Page({

  /**
   * 页面的初始数据
   */
  data: {
    detail: {},
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var url = api.OrderInfo + '/' + app.globalData.userInfo.token + '/' + options.aoId
    util.myRequest(url, false, function(data){
      if (data.data.aoType == 'shop') {
        var aoTakeInfo = JSON.parse(data.data.aoTakeInfo);
        data.data.stName = aoTakeInfo.shop_name;
        data.data.ceName = aoTakeInfo.goods_name;
        data.data.aaMobile = aoTakeInfo.cellphone;
        data.data.aaAddress = aoTakeInfo.address;
        data.data.ssName = '';
        data.data.aaName = aoTakeInfo.user_name;
        data.data.aoMemo = aoTakeInfo.remark
      }
      that.setData({detail: data.data});
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    return app.globalData.shareInfo;
  },
  

  /**
   * 返回
   */
  goBack: function () {
    wx.navigateBack({
      delta: 1
    })
  },
    data: {
      focus: false,
      evaluate_contant: ['配送服务', '商家服务'],
      stars: [0, 1, 2, 3, 4],
      normalSrc: '../../image/huixing.png',
      selectedSrc: '../../image/huangxing.png',
      halfSrc: '../../image/banxing.png',
      score: 0,
      scores: [0, 0, 0],
    },
    bindTextAreaBlur: function(e) {
      console.log(e.detail.value)
    },  
      //点击左边,半颗星
      selectLeft: function (e) {
      var score = e.currentTarget.dataset.score
      if (this.data.score == 0.5 && e.currentTarget.dataset.score == 0.5) {
      score = 0;
      }
      
      this.data.scores[e.currentTarget.dataset.idx] = score,
      this.setData({
      scores: this.data.scores,
      score: score
      })
      
      },
      
      //点击右边,整颗星
      selectRight: function (e) {
      var score = e.currentTarget.dataset.score
      
      this.data.scores[e.currentTarget.dataset.idx] = score,
      this.setData({
      scores: this.data.scores,
      score: score
      })
      }
})